﻿using System;
using System.Collections.Generic;
using System.Windows;
using Baosight.Platform.Core.ServiceModel;
using Baosight.Platform.Core.UI.Controls;
using Baosight.Platform.Core;
using Baosight.ZNH.ZMCommon;
using Telerik.Windows.Controls;
using Baosight.ZNH.ZMCommon.ChildWindows;
using Baosight.ZNH.ZMCL.UI.PopWindows;
using System.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Baosight.ZNH.ZMCL.UI.Blocks;

namespace Baosight.ZNH.ZMCL.UI
{
    /// <summary>
    /// 已反馈三违记录
    /// </summary>
    /// Title:ZMCL82
    /// Service:ServiceZMCL82
    /// Copyright:Baosight Software LTD.co Copyright (c) 2011
    /// Company:上海宝信软件股份有限公司
    /// Author: 高强
    /// Version: 1.0
    /// History:
    ///       2011-06-24 高强   [创建]
    ///  
    public partial class ZMCL82 : EFViewCmes
    {
        private DeregulationBlock _block = new DeregulationBlock();

        public ZMCL82()
        {
            InitializeComponent();
        }

        public override void Initialize(Baosight.Platform.Core.EIInfo initData)
        {
            initData.AddBlock(_block.GetStatusBlock(true));//三违状态
            initData.AddBlock(_block.GetIsTrainBlock(true));//是否培训
            initData.AddBlock(_block.GetIsPenaltyBlock(true));//是否罚款

            base.Initialize(initData);
            this.fdEndDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
        }

        /// <summary>
        /// 弹出窗口关闭时执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PopupWindow_Closed(object sender, WindowClosedEventArgs e)
        {
            //超链接生效
            if (base.TempHyperlink != null)
            {
                base.TempHyperlink.IsEnabled = true;
                base.TempHyperlink = null;
            }
        }

        /// <summary>
        /// 主表记录选择发生改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grid_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if (null != this.grid.SelectedItem)
            {
                EIRow _row = (this.grid.SelectedItem as UIBaseEntity).GetEIRow();

                Dictionary<string, string> args = new Dictionary<string, string>();
                args.Add("fdTernateRecordId", _row["fdTernateRecordId"].ToString());
                this.deregulationDetails.LoadView<EFCustomViewContainerPanel>("ZMCL63", args);//加载从表页面

                Dictionary<string, string> args1 = new Dictionary<string, string>();
                args1.Add("fdPenaltyIds", _row["fdPenaltyIds"] == null ? "" : _row["fdPenaltyIds"].ToString());
                this.deregulationPenalty.LoadView<EFCustomViewContainerPanel>("ZMCL75", args1);//加载从表页面
            }
            else
            {
                this.deregulationDetails.Content = null;
                this.deregulationPenalty.Content = null;
            }
        }
    }
}
